package com.example.shixunandjavagotoyangchen.BoosYang.Day001.Day00111;

import com.example.modelviewpresenter.Model.BasterModel;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * 作者:二徒
 * 时间：2021/11/11- 18:35
 * 功能实现：
 */
public class HonoriaModel extends BasterModel implements HonoriaContion.moder  {
    @Override
    public void getmoder(String name, HonoriaCallback abstractCallback) {
        HonoriaOkhttp.getOkhttp().getRetrofit().create(HonoriaApi.class).getabstract(name)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.computation())
                .subscribe(new Observer<HonoriaBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(HonoriaBean abstractBean) {
                        List<HonoriaBean.DataBean> dataBeanList = abstractBean.getData();
                        abstractCallback.suees(dataBeanList);
                    }

                    @Override
                    public void onError(Throwable e) {
                        abstractCallback.filai("失败");
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}
